<template>
  <div class="">
    <ul>
      <li
        v-for="item in 10"
        :key="item"
        @click="change(item)"
        :class="{ bg: item == flag }"
      >
        {{ item }}
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      flag: -1,
    };
  },
  mounted() {},
  methods: {
    change(index) {
      this.flag = index;
    },
  },
  components: {},
};
</script>

<style lang="scss">
.bg {
  background: #ccc;
}
</style>
